using System;
using System.Collections.Generic;

namespace Microsoft.PowerShell.CmdletManagement
{
    using System;

    /// <summary>
    /// A class that represents a Cmdlet
    /// </summary>
    public class PsSpecCmdlet : ICloneable, IEquatable<PsSpecCmdlet>
    {
        public PsSpecCmdlet() { }

        public PsSpecCmdlet(int id, string snapin, string verb, string noun, string projectName,
            string teamMembers, string shortDescription, string helpShortDescription, string longDescription,
            string helpLongDescription, string status, string helpStatus, bool supportsShouldProcess,
            string notes, string specExamples, PsSpecHelpExample[] helpExamples, string inputObject, string helpInputObjectDescription,
            string outputObject, string outputObjectDescription, string helpOutputObjectDescription,
            string defaultParameterSetName, string relatedTo, string custom1, string custom2,
            string custom3, string custom4, string helpAdditionalNotes)
        {
            this.cmdletId = id;
            this.snapin = snapin;
            this.verb = verb;
            this.noun = noun;
            this.projectName = projectName;
            this.teamMembers = teamMembers;
            this.shortDescription = shortDescription;
            this.longDescription = longDescription;
            this.supportsShouldProcess = supportsShouldProcess;
            this.notes = notes;
            this.specExamples = specExamples;
            this.helpExamples = helpExamples;
            this.outputObject = outputObject;
            this.outputObjectDescription = outputObjectDescription;
            this.relatedTo = relatedTo;
            this.defaultParameterSetName = defaultParameterSetName;
            this.custom1 = custom1;
            this.custom2 = custom2;
            this.custom3 = custom3;
            this.custom4 = custom4;
            this.status = status;
            this.helpStatus = helpStatus;
            this.helpShortDescription = helpShortDescription;
            this.helpLongDescription = helpLongDescription;
            this.inputObject = inputObject;
            this.helpInputObjectDescription = helpInputObjectDescription;
            this.helpOutputObjectDescription = helpOutputObjectDescription;
            this.helpAdditionalNotes = helpAdditionalNotes;
        }

        public int Id
        {
            get { return cmdletId; }
            set { cmdletId = value; }
        }
        private int cmdletId;

        public string Snapin
        {
            get { return snapin; }
            set { snapin = value; }
        }
        private string snapin;

        public string Verb
        {
            get { return verb; }
            set { verb = value; }
        }
        private string verb;

        public string Noun
        {
            get { return noun; }
            set { noun = value; }
        }
        private string noun;

        public string ProjectName
        {
            get { return projectName; }
            set { projectName = value; }
        }
        private string projectName;

        public string TeamMembers
        {
            get { return teamMembers; }
            set { teamMembers = value; }
        }
        private string teamMembers;

        public string ShortDescription
        {
            get { return shortDescription; }
            set { shortDescription = value; }
        }
        private string shortDescription;

        public String HelpShortDescription
        {
            get { return helpShortDescription; }
            set { helpShortDescription = value; }
        }
        private string helpShortDescription;

        public string LongDescription
        {
            get { return longDescription; }
            set { longDescription = value; }
        }
        private string longDescription;

        public String HelpLongDescription
        {
            get { return helpLongDescription; }
            set { helpLongDescription = value; }
        }
        private string helpLongDescription;

        public String Status
        {
            get { return status; }
            set { status = value; }
        }
        private string status;

        public String HelpStatus
        {
            get { return helpStatus; }
            set { helpStatus = value; }
        }
        private string helpStatus;

        public bool SupportsShouldProcess
        {
            get { return supportsShouldProcess; }
            set { supportsShouldProcess = value; }
        }
        private bool supportsShouldProcess;

        public string Notes
        {
            get { return notes; }
            set { notes = value; }
        }
        private string notes;

        public String SpecExamples
        {
            get
            {
                return specExamples;
            }
            set
            {
                specExamples = value;
            }
        }
        private string specExamples;

        public PsSpecHelpExample[] HelpExamples
        {
            get { return helpExamples; }
            set { helpExamples = value; }
        }
        private PsSpecHelpExample[] helpExamples = null;

        public String InputObject
        {
            get { return inputObject; }
            set { inputObject = value; }
        }
        private string inputObject;

        public String HelpInputObjectDescription
        {
            get { return helpInputObjectDescription; }
            set { helpInputObjectDescription = value; }
        }
        private string helpInputObjectDescription;

        public String OutputObject
        {
            get
            {
                return outputObject;
            }
            set
            {
                outputObject = value;
            }
        }
        private string outputObject;

        public String OutputObjectDescription
        {
            get
            {
                return outputObjectDescription;
            }
            set
            {
                outputObjectDescription = value;
            }
        }
        private string outputObjectDescription;

        public String HelpOutputObjectDescription
        {
            get { return helpOutputObjectDescription; }
            set { helpOutputObjectDescription = value; }
        }
        private string helpOutputObjectDescription;

        public String DefaultParameterSetName
        {
            get { return defaultParameterSetName; }
            set { defaultParameterSetName = value; }
        }
        private string defaultParameterSetName;

        public String RelatedTo
        {
            get
            {
                return relatedTo;
            }
            set
            {
                relatedTo = value;
            }
        }
        private string relatedTo;

        public String Custom1
        {
            get { return custom1; }
            set { custom1 = value; }
        }
        private string custom1;

        public String Custom2
        {
            get { return custom2; }
            set { custom2 = value; }
        }
        private string custom2;

        public String Custom3
        {
            get { return custom3; }
            set { custom3 = value; }
        }
        private string custom3;

        public String Custom4
        {
            get { return custom4; }
            set { custom4 = value; }
        }
        private string custom4;

        public String HelpAdditionalNotes
        {
            get { return helpAdditionalNotes; }
            set { helpAdditionalNotes = value; }
        }
        private string helpAdditionalNotes;


        public Object Clone()
        {
            PsSpecCmdlet newCmdlet = (PsSpecCmdlet) this.MemberwiseClone();
            newCmdlet.HelpExamples = new PsSpecHelpExample[HelpExamples.Length];

            for (int counter = 0; counter < HelpExamples.Length; counter++)
            {
                newCmdlet.HelpExamples[counter] = (PsSpecHelpExample) HelpExamples[counter].Clone();
            }

            return newCmdlet;
        }

        #region IEquatable<PsSpecCmdlet> Members

        public bool Equals(PsSpecCmdlet other)
        {
            if (other == null)
            {
                return false;
            }

            List<PsSpecHelpExample> thisExamples = new List<PsSpecHelpExample>();
            if (this.HelpExamples != null)
                thisExamples.AddRange(this.HelpExamples);

            List<PsSpecHelpExample> otherExamples = new List<PsSpecHelpExample>();
            if (other.HelpExamples != null)
                otherExamples.AddRange(other.HelpExamples);


            if ((this.Id == other.Id) &&
                (this.Snapin == other.Snapin) &&
                (this.Verb == other.Verb) &&
                (this.Noun == other.Noun) &&
                (this.ProjectName == other.ProjectName) &&
                (this.TeamMembers == other.TeamMembers) &&
                (this.ShortDescription == other.ShortDescription) &&
                (this.LongDescription == other.LongDescription) &&
                (this.SupportsShouldProcess == other.SupportsShouldProcess) &&
                (this.Notes == other.Notes) &&
                (this.SpecExamples == other.SpecExamples) &&
                (thisExamples.Count == otherExamples.Count) &&
                (this.OutputObject == other.OutputObject) &&
                (this.OutputObjectDescription == other.OutputObjectDescription) &&
                (this.RelatedTo == other.RelatedTo) &&
                (this.DefaultParameterSetName == other.DefaultParameterSetName) &&
                (this.Custom1 == other.Custom1) &&
                (this.Custom2 == other.Custom2) &&
                (this.Custom3 == other.Custom3) &&
                (this.Custom4 == other.Custom4) &&
                (this.Status == other.Status) &&
                (this.HelpStatus == other.HelpStatus) &&
                (this.HelpShortDescription == other.HelpShortDescription) &&
                (this.HelpLongDescription == other.HelpLongDescription) &&
                (this.InputObject == other.InputObject) &&
                (this.HelpInputObjectDescription == other.HelpInputObjectDescription) &&
                (this.HelpOutputObjectDescription == other.HelpOutputObjectDescription) &&
                (this.HelpAdditionalNotes == other.HelpAdditionalNotes))
            {
                for (int counter = 0; counter < thisExamples.Count; counter++)
                {
                    if (! thisExamples[counter].Equals(otherExamples[counter]))
                        return false;
                }

                return true;
            }
            else
            {
                return false;
            }
        }
        #endregion
    }
}